package cn.jas.business.jasbusiness.web;

import cn.jas.business.jasbusiness.service.HealthService;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: jas-parent
 * @description: 测试接口专用
 * @author: chen_mx
 * @create: 2020-01-14 18:25
 **/
@RestController
public class TestController {

    @Autowired
    private HealthService  healthService;

    @Autowired
    private EurekaClient  eurekaClient;

    @RequestMapping("/isOk")
    public  String  testController(){
        return  "isOk";
    }

    @RequestMapping("/status")
    public  String  status(){
        List<InstanceInfo> list=eurekaClient.getInstancesByVipAddress("jas-base",false);
        for(InstanceInfo  info:list){
            System.out.println(info.getAppName());
            System.out.println(info.getHostName());
        }
        return  healthService.status();
    }


}
